Conversation
|
| if date < 1 or date > 31: | ||
| raise ValueError("Date value must be between 1 and 31") | ||
| if weekday < 0 or weekday > 6: | ||
| raise ValueError("Weekday value must be between 0 and 6") |
There was a problem hiding this comment.
Should we also have these statements check if the value passed is None or would it just not accept it if one of the values in the tuple that is sent in is just None.
Example:
c.rtc.set_date(99,None,29,5)There was a problem hiding this comment.
Hello! I think it's a good idea to enforce that the full date be set, as I don't really see a use case for partial dates, and it can lead to weird behavior that the user would have to manage. Also, the plan is to eventually replace this format with the datetime iso8601 compliant format in the future, which will require a full date anyway.
Let me know if you have a specific use case for partial dates in mind though!
There was a problem hiding this comment.
That sounds good to me! I'll just rubber stamps this for now and we can circle back to full date checking in a future update.



This PR only adds value checking to the RTC set time, date and alarm fields for ease of understanding when using. This will prevent things like proveskit/pysquared#164 from happening in the future.